#include <tchar.h>
#include <stdio.h>
#include <Windows.h>
#pragma comment(lib, "./../debug/DllLib.lib")

#define DLLAPI extern "C" __declspec(dllimport)

DLLAPI int Add(int nLeft, int nRight);
DLLAPI int Sub(int nLeft, int nRight);


bool IsModuleLoaded(const TCHAR* szModuleName)
{
	return GetModuleHandle(szModuleName);
}

void PrintLoadInfo()
{
	if (IsModuleLoaded(_T("dllLib.dll")))
	{
		_tprintf(_T("dll is loaded\n"));
	} else {
		_tprintf(_T("dll isn't loaded\n"));
	}
}

void main()
{
	PrintLoadInfo();

	int nLeft = 100, nRight = 120;
	_tprintf(_T("Add(%d, %d) = %d\n"), nLeft, nRight, Add(nLeft, nRight));
	
	PrintLoadInfo();

	_tprintf(_T("Sub(%d, %d) = %d\n"), nLeft, nRight, Sub(nLeft, nRight));
	
	system("pause");
	return;
}